package niuke;

import java.util.Scanner;

public class 解救小易 {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        int a[] = new int[n];
        int b[] = new int[n];
        int min=999999999;
        int sum = 0;
        for(int i=0;i<n;i++){
            a[i] = scanner.nextInt();
        }
        for(int i2=0;i2<n;i2++){
            b[i2] = scanner.nextInt();
        }
        for(int i=0;i<n;i++){
           sum = a[i] + b[i];
           if(sum<min){
               min = sum;
           }
        }
        System.out.println(min-2);
    }
}
